package com.example.actearly_revised;

import java.util.List;

import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CustomListAdapter extends BaseAdapter {

	private String[]        strings; // obviously don't use object, use whatever you really want
	private final Context   context;
	Typeface font;

	public CustomListAdapter(Context context, String[] strings) {
		this.context = context;
		this.strings = strings;
	}

	@Override
	public int getCount() {
		return strings.length;
	}

	@Override
	public Object getItem(int position) {
		return strings[position];
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {


		if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.activity_list_layout, null);
        }
		
		TextView tv = (TextView) convertView.findViewById(R.id.listText);
		tv.setText(strings[position]);
		// set whatever typeface you want here as well
		font=Typeface.createFromAsset(context.getAssets(), "fonts/futuram.ttf");
		tv.setTypeface(font);
		return convertView;
	}

}